﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;

using ZWGBlog.Specification;

namespace ZWQBlog.Repository.Contract
{
    public interface IRepository<TEntity, TPageData> where TEntity : class, new()
    {
        IList<TEntity> FindAll();

        TPageData FindAll<TOrderBy>(
            int pageIndex,
            int pageSize,
            ISpecification<TEntity> where,
            Expression<Func<TEntity, TOrderBy>> orderBy,
            bool isDesc
            );

        TEntity Find(ISpecification<TEntity> where);
        void Add(TEntity entity);
        void Delete(TEntity entity);
        void Update(TEntity entity);
    }
}